package cn.edu.ctbu.test.dao;

import cn.edu.ctbu.test.domain.Student;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import static org.hibernate.loader.Loader.SELECT;
import java.util.List;


public interface StudentRepository extends JpaRepository<Student,Long> {

    @Query("select o from student o where o.name = ?1")
    List<Student> xz(String name);

    @Query("select s from student as s where s.name like %?1%")
    List<Student> findByName(String name);

//    @Query("select s from student as s where s.name like %?1%")
//    Page<Student> findByName(String name, Pageable pageable);



    List<Student> findAll(Specification<Student> studentSpecification);


    Page<Student> findAll(Specification<Student> studentSpecification, Pageable pageable);

    Integer count(Specification<Student> studentSpecification);

    List<Student> findByNameAndPassWord(String name,String password);


}
